#include <iostream>
#include <vector>
#include <string>
using namespace std;

int main()
{
	int N, M, K;
	cin >> N >> M >> K;

	vector<vector<int>> tests(M);
	vector<char> results(M);

	for (int i = 0; i < M; ++i)
	{
		int C;
		cin >> C;
		tests[i].resize(C);
		for (int j = 0; j < C; ++j)
		{
			cin >> tests[i][j];
		}
		cin >> results[i];
	}

	int valid_combinations = 0;

	for (int mask = 0; mask < (1 << N); ++mask)
	{
		bool valid = true;

		for (int i = 0; i < M && valid==true; ++i)
		{
			int true_count = 0;
			for (int key : tests[i])
			{
				if (mask & (1 << (key - 1)))
				{
					++true_count;
				}
			}

			if ((results[i] == 'o' && true_count < K) ||
			        (results[i] == 'x' && true_count >= K))
			{
				valid = false;
			}
		}

		if (valid)
		{
			++valid_combinations;
		}
	}

	cout << valid_combinations << endl;

	return 0;
}


